package com.cjm.one.goods.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.entity.GoodsSpec;
import com.cjm.one.model.goods.vo.GoodsInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = ServerConstants.SERVER_ONE_GOODS)
public interface GoodsSpecClient {

    @GetMapping("/admin/goods/spec/list")
    @Operation(summary = "获取商品规格列表")
    Result<Page<GoodsSpec>> list(@RequestParam(name = "current") Long current,
                                        @RequestParam(name = "size") Long size,
                                        @RequestParam(name = "name",required = false) String specName);

    @GetMapping("/admin/goods/spec/{id}")
    @Operation(summary = "根据id查询")
    Result<GoodsSpec> getById(@PathVariable("id") Long id);

    @DeleteMapping("/admin/goods/spec/{id}")
    @Operation(summary = "根据id删除商品规格")
    Result<Boolean> delete(@PathVariable(name = "id") Long id);

    @PutMapping("/admin/goods/spec")
    @Operation(summary = "更新商品规格")
    Result<Boolean> update(@RequestBody GoodsSpec goodsSpec);
    @PostMapping("/admin/goods/spec")
    @Operation(summary = "添加商品规格")
    Result<Boolean> add(@RequestBody GoodsSpec goodsSpec);

    @GetMapping("/admin/goods/spec/all")
    @Operation(summary = "获取所有商品规格")
    Result<List<GoodsSpec>> all();
}
